<!DOCTYPE HTML>
<html>
<head>
    <include file="Common:header_include"/>
    <title>编辑用户</title>
</head>
<body>
<div class="pd-20">
    <form action="{:U('edit')}" method="post" class="form form-horizontal" id="form">
        <input type="text" name="id" hidden value="{$data.id}">
        <input type="text" name="user_group_id" hidden value="{$data.user_group_id}">
        <!--<div class="row cl">-->
        <!--<label class="form-label col-3"><span class="c-red">*</span>用户组：</label>-->
        <!--<div class="formControls col-5">-->
        <!--{$data.user_group.title}-->
        <!--</div>-->
        <!--<div class="col-4"></div>-->
        <!--</div>-->
        <if condition="session('user')['user_group_id'] eq 1">
            <div class="row cl">
                <label class="form-label col-3"><span class="c-red">*</span>用户组：</label>
                <div class="formControls col-5">
                    <span class="select-box">
                    <select class="select Validform_error" size="1" name="user_group_id" datatype="*" nullmsg="请选择" onchange="selectUserGroup($(this))">
                        <!--<option value="" selected="" disabled="disabled">请选择</option>-->
                        <volist name=":getList('user_group')" id="v">
                            <option <if condition="$data['user_group_id'] eq $v['id']"> selected </if> value="{$v.id}">{$v.title}</option>
                        </volist>
                    </select>
                    </span>
                </div>
                <div class="col-4"></div>
            </div>
        </if>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red">*</span>用户名：</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" name="name" datatype="s3-18" value="{$data.name}">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>密码：</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" placeholder="请输入6-18位字符" name="pwd" onfocus="this.type='password'">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>密码确认：</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" placeholder="请输入6-18位字符" name="pwd2" onfocus="this.type='password'">
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>手机号：</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" placeholder="请输入" name="phone" <if condition="!empty($data['phone'])"> value="{$data.phone}"</if>>
            </div>
            <div class="col-4"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-3"><span class="c-red"></span>邮箱：</label>
            <div class="formControls col-5">
                <input type="text" class="input-text" placeholder="请输入" name="email" value="{$data.email}">
            </div>
            <div class="col-4"></div>
        </div>
        <!--<div class="row cl">-->
        <!--<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>用户状态：</label>-->
        <!--<div class="formControls col-xs-8 col-sm-9 skin-minimal">-->
        <!--<div class="radio-box">-->
        <!--<input name="status" type="radio" <if condition="$data['status'] eq 1"> checked </if> value="{$data.status}">-->
        <!--<label>启用</label>-->
        <!--</div>-->
        <!--<div class="radio-box">-->
        <!--<input type="radio" name="status" <if condition="$data['status'] eq 0"> checked </if> value="{$data.status}">-->
        <!--<label>禁用</label>-->
        <!--</div>-->
        <!--</div>-->
        <!--</div>-->
        <div class="row cl">
            <div class="col-9 col-offset-3">
                <input class="btn btn-primary radius" type="submit" value="提交">
            </div>
        </div>
    </form>
</div>
</div>
<include file="Common:footer_include"/>
<script>
    $(function(){
        selectUserGroup($('input[name="user_group_id"]'));
    });
    /**
     * 切换表单必填项
     * @param obj
     */
    function selectUserGroup(obj) {
        var value = obj.val();
        if (value == 2) {
            $('.patient').hide();
            $('.doctor').show();
        } else if (value == 3) {
            $('.patient').show();
            $('.doctor').hide();
        } else {
            $('.patient').hide();
            $('.doctor').hide();
        }
    }

    $('.skin-minimal input').iCheck({
        checkboxClass: 'icheckbox-blue',
        radioClass: 'iradio-blue',
        increaseArea: '20%'
    });

</script>
</body>
</html>